package com.cn.serverline.lineicp.productionLine.controller;

import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import com.cn.serverline.lineicp.productionLine.entity.DetailsCollation;
import com.cn.serverline.lineicp.productionLine.service.IDetailsCollationService;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * 交付计划详情排序规则 接口
 *
 * @author 郭明然
 * @since 2024-08-22
 */
@RestController
@ApiResource(name = "交付计划详情排序规则的接口")
public class DetailsCollationController {

    @Resource(name = "DetailsCollationServiceImpl")
    private IDetailsCollationService iDetailsCollationService;

    /**
     * 添加交付计划详情排序规则
     */
    @PostResource(name = "添加交付计划详情排序规则", path = "/productionLine/detailsCollation/add")
    public ResponseData<DetailsCollation> add(@RequestBody @Validated DetailsCollation detailsCollation){
        iDetailsCollationService.add(detailsCollation);
        return new SuccessResponseData<>();
    }

    /**
     * 删除交付计划详情排序规则
     */
    @PostResource(name = "删除交付计划详情排序规则", path = "/productionLine/detailsCollation/delete")
    public ResponseData<?> delete(@RequestBody @Validated DetailsCollation  detailsCollation){
        iDetailsCollationService.del(detailsCollation);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑交付计划详情排序规则
     */
    @PostResource(name = "编辑交付计划详情排序规则", path = "/productionLine/detailsCollation/edit")
    public ResponseData<?> edit(@RequestBody @Validated DetailsCollation detailsCollation) {
        iDetailsCollationService.edit(detailsCollation);
        return new SuccessResponseData<>();
    }

    /**
     * 分页查询-交付计划详情排序规则列表
     */
    @GetResource(name = "分页查询-交付计划详情排序规则列表", path = "/productionLine/detailsCollation/page")
    public ResponseData<PageResult<DetailsCollation>> page(DetailsCollation detailsCollation) {
        return new SuccessResponseData<>(iDetailsCollationService.findPage(detailsCollation));
    }

}
